from django.db import models

# Create your models here.


class Department(models.Model):
    name = models.CharField(max_length=50)
    num = models.IntegerField()
    class Meta:
        db_table = "Department"
    def __str__(self):
        return self.name


class User(models.Model):
    username = models.CharField(max_length=50)
    password = models.CharField(max_length=200)
    authrity = models.IntegerField(default=2)  # 1代表有vip  2代表普通
    department = models.ForeignKey(Department,on_delete=models.CASCADE)
    class Meta:
        db_table = "User"

class Qusers(models.Model):
    username = models.CharField(max_length=50)
    password = models.CharField(max_length=50)
    class Meta:
        db_table = "Qusers"

class Goods(models.Model):
    name = models.CharField(max_length=50)
    price = models.DecimalField(max_digits=7,decimal_places=2)
    pic = models.ImageField()
    num = models.IntegerField(default=0)
    class Meta:
        db_table = "Goods"

class Car(models.Model):
    num = models.IntegerField()
    qusers = models.ForeignKey(Qusers,on_delete=models.CASCADE)
    goods = models.ForeignKey(Goods,on_delete=models.CASCADE)
    class Meta:
        db_table = "Car"

class Zhuce(models.Model):
    name = models.CharField(max_length=50)
    password = models.CharField(max_length=50)
    sjh = models.CharField(max_length=11)
    class Meta:
        db_table = "Zhuce"


